package vip.liux.backend.infrastructure.jpa.product;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import vip.liux.contracts.models.product.Brand;
import vip.liux.contracts.repositories.product.BrandRepository;

public interface BrandJpaRepository extends JpaRepository<Brand, Long>, BrandRepository {

    @Query("select b from Brand b where ( :search is null or b.brandName like %:search% or b.description like %:search%  or b.brandNo like %:search%)")
    @Override
    Page<Brand> findAllByKeyword(Pageable page, String search);
}